package org.apache.ibatis.test.config;

import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.wrapper.ObjectWrapper;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;

import java.util.Map;

/**
 * @Description
 * @Author houchenkai
 * @Created Date: 2020/9/25 16:43
 * @ClassName
 */
public class MapWrapperFactory implements ObjectWrapperFactory {
  @Override
  public boolean hasWrapperFor(Object object) {
    return object instanceof Map;
  }

  @Override
  public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {
    return new MyMapWrapper(metaObject, (Map<String, Object>)object);
  }


}
